home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-09 | 2.9 KB | 77 lines | [TEXT/CWIE] |
- // =================================================================================
- // CDragItem.h ©1995 J. Rodden, DD/MF & Associates. All rights reserved
- // =================================================================================
- // Mixin class to be used with anything that supports dragging of it's items.
- // CDragItem encapsulates the characteristics of a draggable item.
- //
- // By using CDragItem and overriding AddFlavors and MakeDragRegion, you can
- // (a) include as many flavors of an item as you want, (b) define your own outline
- // to replace the generic rectangle that LDragTask provides, (c) arrange to send
- // drag data on demand by calling InstallDragSendData when adding flavors (and
- // installing null data in the drag) and overriding DoSendDragData for the object
- // being dragged, and (d) override the drag manager's default behaviors for DragInput
- // and DragDrawing by calling InstallDragInput or InstallDragDrawing and overriding
- // DoDragInput or DoDragDrawing respectively.
- // =================================================================================
-
- #pragma once
-
- #include <PP_Prefix.h>
-
- #ifndef __DRAG__
- #include <Drag.h>
- #endif
-
- const ItemReference kItemRef = 1;
-
- // =================================================================================
- // • CDragItem
- // =================================================================================
-
- class CDragItem
- {
- public:
- CDragItem() { };
- virtual ~CDragItem() { };
-
- virtual void AddFlavors(DragReference inDragRef);
- virtual void MakeDragRegion( DragReference inDragRef, RgnHandle inDragRegion);
-
- virtual void SetLocalFrame();
- virtual void DrawDragRegion();
- virtual Boolean AddToDragRgn(RgnHandle inDragRegion);
- virtual void OutlineRegion(RgnHandle inRegion);
-
- virtual void DoDragSendData(FlavorType inFlavor,
- ItemReference inItemRef,
- DragReference inDragRef);
-
- virtual void DoDragInput(Point *ioMouse, Int16 *ioModifiers,
- DragReference inDragRef);
-
- virtual void DoDragDrawing(DragRegionMessage inMessage,
- RgnHandle inShowRgn, Point inShowOrigin,
- RgnHandle inHideRgn, Point inHideOrigin,
- DragReference inDragRef);
-
- virtual void InstallDragSendData(DragReference inDragRef);
- virtual void InstallDragInput(DragReference inDragRef);
- virtual void InstallDragDrawing(DragReference inDragRef);
-
- static pascal OSErr HandleDragSendData(FlavorType inFlavor,
- void *inRefCon, ItemReference inItemRef,
- DragReference inDragRef);
-
- static pascal OSErr HandleDragInput(Point *ioMouse, Int16 *ioModifiers,
- void *inRefCon, DragReference inDragRef);
-
- static pascal OSErr HandleDragDrawing(DragRegionMessage inMessage,
- RgnHandle inShowRgn, Point inShowOrigin,
- RgnHandle inHideRgn, Point inHideOrigin,
- void *inRefCon, DragReference inDragRef);
-
- protected:
- Rect mLocalFrame;
- };
-
-